package com.stu.status;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.stu.aq.*;
import com.stu.widget.*;
 
public class CompassFragment extends Fragment {
	private CompassView compass;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
	  Bundle sis) {
		View view = inflater.inflate(R.layout.compass, container, false);
		compass = (CompassView)view.findViewById(R.id.compass);
		return view;
	}

	/**
	 * @param roll -180 to +180
	 * @param pitch -90 to +90
	 * @param heading 0 to 359
	 */
	public void setCompass( float roll, float pitch, float heading ) {
		compass.setPitch( pitch );
		compass.setHeading( heading );
		compass.setRoll( roll );
		compass.invalidate();
	}

	public void clear() {
		compass.setPitch( 0 );
		compass.setHeading( 0 );
		compass.setRoll( 0 );
		compass.invalidate();
	}
} 
